\hypertarget{network_8c}{}\section{network/network.c File Reference}
\label{network_8c}\index{network/network.\+c@{network/network.\+c}}


Network test client This code receives a message and displays iit.  


{\ttfamily \#include \char`\"{}user\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include $<$stdint.\+h$>$}\\*
{\ttfamily \#include $<$stdarg.\+h$>$}\\*
{\ttfamily \#include $<$string.\+h$>$}\\*
{\ttfamily \#include $<$math.\+h$>$}\\*
{\ttfamily \#include \char`\"{}display/ili9341.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}network/network.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}../../ssid.\+h\char`\"{}}\\*
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} char $\ast$ \hyperlink{network_8c_a462d02d06dadbf41aa44824e310aaaf0}{ipv4\+\_\+2str} (\hyperlink{send_8c_a435d1572bf3f880d55459d9805097f62}{uint32\+\_\+t} ip)
\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{network_8c_a33001f6e7c0326d6a8f20acbc62a1b3a}{wifi\+\_\+event\+\_\+cb} (System\+\_\+\+Event\+\_\+t $\ast$event\+\_\+p)
\begin{DoxyCompactList}\small\item\em W\+I\+FI Event Callback. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{network_8c_ad9b36f95313ac904d2d3ace6f844201b}{setup\+\_\+networking} ()
\begin{DoxyCompactList}\small\item\em Code fragments if(!wifi\+\_\+station\+\_\+dhcpc\+\_\+stop()) printf( \char`\"{}\+E\+R\+R\+O\+R wifi\+\_\+station\+\_\+dhcpc\+\_\+stop() \textbackslash{}n \char`\"{});. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{network_8c_a216a891e9fdcc4083d4fb922eacb63f0}{network\+\_\+init} = 0
\item 
\hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} \hyperlink{network_8c_ab09a3ef6a7cb9dabda17af1c09d36cc2}{ip\+\_\+msg} \mbox{[}64\mbox{]}
\begin{DoxyCompactList}\small\item\em test task Runs corrected cube demo from Sem Optionally wireframe Earth viewer \end{DoxyCompactList}\item 
int \hyperlink{network_8c_aeceba101b4877f92b9c39706420d26a3}{ip\+\_\+msg\+\_\+state}
\item 
static struct station\+\_\+config \hyperlink{network_8c_a63cab1cdb68d6495494e1967e0f909cf}{Station\+Config}
\item 
static struct ip\+\_\+info \hyperlink{network_8c_a1202cd63c360958e6272f9a20fa90f8b}{info}
\item 
static \hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} \hyperlink{network_8c_ad6ffa7743848d35021d59a06df02d7cb}{macaddr} \mbox{[}6\mbox{]}
\item 
static \hyperlink{send_8c_aba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t} \hyperlink{network_8c_ac7c4860b47674f6bb351f6875e50533f}{received} = 0
\item 
static char \hyperlink{network_8c_a252582da71dd6f7e793a6243bdcd0ab4}{\+\_\+ipv4\+\_\+2str} \mbox{[}32\mbox{]}
\begin{DoxyCompactList}\small\item\em Convert IP address to string. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Network test client This code receives a message and displays iit. 

\begin{DoxyParagraph}{Copyright \copyright{} 2015 Mike Gore, G\+PL License}

\end{DoxyParagraph}
\begin{DoxyParagraph}{You are free to use this code under the terms of G\+PL}
please retain a copy of this notice in any code you use it in.
\end{DoxyParagraph}
This is free software\+: you can redistribute it and/or modify it under the terms of the G\+NU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but W\+I\+T\+H\+O\+UT A\+NY W\+A\+R\+R\+A\+N\+TY; without even the implied warranty of M\+E\+R\+C\+H\+A\+N\+T\+A\+B\+I\+L\+I\+TY or F\+I\+T\+N\+E\+SS F\+OR A P\+A\+R\+T\+I\+C\+U\+L\+AR P\+U\+R\+P\+O\+SE. See the G\+NU General Public License for more details.

You should have received a copy of the G\+NU General Public License along with this program. If not, see \href{http://www.gnu.org/licenses/}{\tt http\+://www.\+gnu.\+org/licenses/}. 

\subsection{Function Documentation}
\index{network.\+c@{network.\+c}!ipv4\+\_\+2str@{ipv4\+\_\+2str}}
\index{ipv4\+\_\+2str@{ipv4\+\_\+2str}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{ipv4\+\_\+2str(uint32\+\_\+t ip)}{ipv4_2str(uint32_t ip)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} char$\ast$ ipv4\+\_\+2str (
\begin{DoxyParamCaption}
\item[{{\bf uint32\+\_\+t}}]{ip}
\end{DoxyParamCaption}
)}\hypertarget{network_8c_a462d02d06dadbf41aa44824e310aaaf0}{}\label{network_8c_a462d02d06dadbf41aa44824e310aaaf0}


Definition at line 66 of file network.\+c.



Referenced by ntp\+\_\+setup(), and user\+\_\+loop().

\index{network.\+c@{network.\+c}!setup\+\_\+networking@{setup\+\_\+networking}}
\index{setup\+\_\+networking@{setup\+\_\+networking}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{setup\+\_\+networking()}{setup_networking()}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void setup\+\_\+networking (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\hypertarget{network_8c_ad9b36f95313ac904d2d3ace6f844201b}{}\label{network_8c_ad9b36f95313ac904d2d3ace6f844201b}


Code fragments if(!wifi\+\_\+station\+\_\+dhcpc\+\_\+stop()) printf( \char`\"{}\+E\+R\+R\+O\+R wifi\+\_\+station\+\_\+dhcpc\+\_\+stop() \textbackslash{}n \char`\"{});. 

if(!wifi\+\_\+set\+\_\+ip\+\_\+info( S\+T\+A\+T\+I\+O\+N\+\_\+\+IF , \&info)) printf( \char`\"{}\+E\+R\+R\+O\+R wifi\+\_\+set\+\_\+ip\+\_\+info()\textbackslash{}n\char`\"{});

if(!wifi\+\_\+station\+\_\+connect()) printf( \char`\"{}\+E\+R\+R\+O\+R wifi\+\_\+station\+\_\+connect()\textbackslash{}n\char`\"{});

if(!wifi\+\_\+station\+\_\+set\+\_\+auto\+\_\+connect( T\+R\+UE) ) printf(\char`\"{}\+E\+R\+R\+O\+R wifi\+\_\+station\+\_\+set\+\_\+auto\+\_\+connect(1)\textbackslash{}n\char`\"{}); I\+P4\+\_\+\+A\+D\+DR( \& info.\+ip , 192 , 168 , 200 , 123); I\+P4\+\_\+\+A\+D\+DR( \& info.\+netmask , 255 , 255 , 255 , 0); I\+P4\+\_\+\+A\+D\+DR( \& info.\+gw, 192 , 168 , 200 , 1); if(!wifi\+\_\+set\+\_\+ip\+\_\+info( S\+T\+A\+T\+I\+O\+N\+\_\+\+IF , \&info) ) printf( \char`\"{}\+E\+R\+R\+O\+R wifi\+\_\+set\+\_\+ip\+\_\+info() \textbackslash{}n \char`\"{}); if(!wifi\+\_\+station\+\_\+set\+\_\+auto\+\_\+connect( T\+R\+UE) ) printf( \char`\"{}\+E\+R\+R\+O\+R wifi\+\_\+station\+\_\+set\+\_\+auto\+\_\+connect(1) \textbackslash{}n \char`\"{}); Setup Wifi Network Credits\+: ideas borrowed from David Ogilvy(\+Metal\+Phreak) \begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 165 of file network.\+c.



Referenced by setup().

\index{network.\+c@{network.\+c}!wifi\+\_\+event\+\_\+cb@{wifi\+\_\+event\+\_\+cb}}
\index{wifi\+\_\+event\+\_\+cb@{wifi\+\_\+event\+\_\+cb}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{wifi\+\_\+event\+\_\+cb(\+System\+\_\+\+Event\+\_\+t $\ast$event\+\_\+p)}{wifi_event_cb(System_Event_t *event_p)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void wifi\+\_\+event\+\_\+cb (
\begin{DoxyParamCaption}
\item[{System\+\_\+\+Event\+\_\+t $\ast$}]{event\+\_\+p}
\end{DoxyParamCaption}
)}\hypertarget{network_8c_a33001f6e7c0326d6a8f20acbc62a1b3a}{}\label{network_8c_a33001f6e7c0326d6a8f20acbc62a1b3a}


W\+I\+FI Event Callback. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$event\+\_\+p} & Wifi event structure This callback status code borrowed from David Ogilvy(\+Metal\+Phreak) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 80 of file network.\+c.



Referenced by setup\+\_\+networking().



\subsection{Variable Documentation}
\index{network.\+c@{network.\+c}!\+\_\+ipv4\+\_\+2str@{\+\_\+ipv4\+\_\+2str}}
\index{\+\_\+ipv4\+\_\+2str@{\+\_\+ipv4\+\_\+2str}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{\+\_\+ipv4\+\_\+2str}{_ipv4_2str}}]{\setlength{\rightskip}{0pt plus 5cm}char \+\_\+ipv4\+\_\+2str\mbox{[}32\mbox{]}\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{network_8c_a252582da71dd6f7e793a6243bdcd0ab4}{}\label{network_8c_a252582da71dd6f7e793a6243bdcd0ab4}


Convert IP address to string. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em ip} & I\+P\+V4 address \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
char $\ast$ pointer to string result 
\end{DoxyReturn}


Definition at line 64 of file network.\+c.



Referenced by ipv4\+\_\+2str().

\index{network.\+c@{network.\+c}!info@{info}}
\index{info@{info}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{info}{info}}]{\setlength{\rightskip}{0pt plus 5cm}struct ip\+\_\+info info\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{network_8c_a1202cd63c360958e6272f9a20fa90f8b}{}\label{network_8c_a1202cd63c360958e6272f9a20fa90f8b}


Definition at line 55 of file network.\+c.



Referenced by fatfs\+\_\+ls(), fatfs\+\_\+scan\+\_\+files(), Free\+Font(), Init\+Fonts(), main(), setup\+\_\+networking(), and stat().

\index{network.\+c@{network.\+c}!ip\+\_\+msg@{ip\+\_\+msg}}
\index{ip\+\_\+msg@{ip\+\_\+msg}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{ip\+\_\+msg}{ip_msg}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf uint8\+\_\+t} ip\+\_\+msg\mbox{[}64\mbox{]}}\hypertarget{network_8c_ab09a3ef6a7cb9dabda17af1c09d36cc2}{}\label{network_8c_ab09a3ef6a7cb9dabda17af1c09d36cc2}


test task Runs corrected cube demo from Sem Optionally wireframe Earth viewer 

\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 51 of file network.\+c.



Referenced by setup(), setup\+\_\+networking(), and wifi\+\_\+event\+\_\+cb().

\index{network.\+c@{network.\+c}!ip\+\_\+msg\+\_\+state@{ip\+\_\+msg\+\_\+state}}
\index{ip\+\_\+msg\+\_\+state@{ip\+\_\+msg\+\_\+state}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{ip\+\_\+msg\+\_\+state}{ip_msg_state}}]{\setlength{\rightskip}{0pt plus 5cm}int ip\+\_\+msg\+\_\+state}\hypertarget{network_8c_aeceba101b4877f92b9c39706420d26a3}{}\label{network_8c_aeceba101b4877f92b9c39706420d26a3}


Definition at line 52 of file network.\+c.



Referenced by wifi\+\_\+event\+\_\+cb().

\index{network.\+c@{network.\+c}!macaddr@{macaddr}}
\index{macaddr@{macaddr}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{macaddr}{macaddr}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf uint8\+\_\+t} macaddr\mbox{[}6\mbox{]}\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{network_8c_ad6ffa7743848d35021d59a06df02d7cb}{}\label{network_8c_ad6ffa7743848d35021d59a06df02d7cb}


Definition at line 56 of file network.\+c.



Referenced by setup\+\_\+networking().

\index{network.\+c@{network.\+c}!network\+\_\+init@{network\+\_\+init}}
\index{network\+\_\+init@{network\+\_\+init}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{network\+\_\+init}{network_init}}]{\setlength{\rightskip}{0pt plus 5cm}int network\+\_\+init = 0}\hypertarget{network_8c_a216a891e9fdcc4083d4fb922eacb63f0}{}\label{network_8c_a216a891e9fdcc4083d4fb922eacb63f0}


Definition at line 50 of file network.\+c.



Referenced by ntp\+\_\+setup(), and wifi\+\_\+event\+\_\+cb().

\index{network.\+c@{network.\+c}!received@{received}}
\index{received@{received}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{received}{received}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf uint8\+\_\+t} received = 0\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{network_8c_ac7c4860b47674f6bb351f6875e50533f}{}\label{network_8c_ac7c4860b47674f6bb351f6875e50533f}


Definition at line 57 of file network.\+c.

\index{network.\+c@{network.\+c}!Station\+Config@{Station\+Config}}
\index{Station\+Config@{Station\+Config}!network.\+c@{network.\+c}}
\subsubsection[{\texorpdfstring{Station\+Config}{StationConfig}}]{\setlength{\rightskip}{0pt plus 5cm}struct station\+\_\+config Station\+Config\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{network_8c_a63cab1cdb68d6495494e1967e0f909cf}{}\label{network_8c_a63cab1cdb68d6495494e1967e0f909cf}


Definition at line 54 of file network.\+c.



Referenced by setup\+\_\+networking().

